import request from '@/utils/request'
import Qs from 'qs'

// 活动相关接口
// 获取活动列表	GET o2o/adm/v1/eventsInfo/list?page=1&pageSize=10
export function getEventsInfoList(params) {
  return request({
    url: `/adm/v1/eventsInfo/page/list`,
    method: 'get',
    params: params
  })
}
// 活动详情	GET o2o/adm/v1/eventsInfo/details/2
export function getEventsInfoDetail(id) {
  return request({
    url: `/adm/v1/eventsInfo/${id}`,
    method: 'get',
  })
}
// 添加一个活动	POST o2o/adm/v1/eventsInfo/add
export function addEventsInfo(data) {
  return request({
    url: `/adm/v1/eventsInfo`,
    method: 'post',
    data,
  })
}
// 修改活动	PUT o2o/adm/v1/eventsInfo/edit
export function editEventsInfo(data, method) {
  return request({
    url: `/adm/v1/eventsInfo`,
    method,
    data
  })
}
// 删除活动	DELETE o2o/adm/v1/eventsInfo/del
export function deleteEventsInfo(id) {
  return request({
    url: `/adm/v1/eventsInfo/${id}`,
    method: 'delete',
  })
}

// 活动参与人列表	GET /adm/v1/eventsOrderPerson/page/listByEventOrderId?page=1&pageSize=10
export function getEventPersonList(params) {
  return request({
    url: "/adm/v1/eventsOrderPerson/page/listByEventOrderId",
    method: 'get',
    params,
  })
}

// 活动参与宠物列表	GET /adm/v1/eventsOrderPet/page/listByEventOrderId?page=1&pageSize=10
export function getEventPetList(params) {
  return request({
    url: "/adm/v1/eventsOrderPet/page/listByEventOrderId",
    method: 'get',
    params,
  })
}

// 活动协议列表	GET /adm/v1/agreementInfo/page/list?page=1&pageSize=10
export function getAgreementInfoList(params) {
  return request({
    url: "/adm/v1/agreementInfo/page/list",
    method: 'get',
    params,
  })
}

// 添加活动协议	POST o2o/adm/v1/agreementInfo
export function addAgreementInfo(data) {
  return request({
    url: `/adm/v1/agreementInfo`,
    method: 'post',
    data,
  })
}
// 修改活动协议	PUT o2o/adm/v1/agreementInfo
export function editAgreementInfo(data) {
  return request({
    url: `/adm/v1/agreementInfo`,
    method: 'put',
    data,
  })
}


// 活动评论列表	PUT o2o/adm/v1/getReviewList
export function getReviewList(params) {
  return request({
    url: `/adm/v1/reviewInfo/page/list`,
    method: 'get',
    params,
  })
}

// 审核评论记录	PUT o2o/adm/v1/agreementInfo
export function auditReview(data) {
  return request({
    url: `/adm/v1/reviewInfo`,
    method: 'put',
    data,
  })
}



// 活动核销员列表	GET o2o/adm/v1/getVerifierList
export function getVerifierList(params) {
  return request({
    url: `/adm/v1/verifier/page/list`,
    method: 'get',
    params,
  })
}


// 添加活动核销员 POST o2o/adm/v1/verifier
export function addVerifier(data) {
  return request({
    url: `/adm/v1/verifier`,
    method: 'post',
    data,
  })
}
// 修改活动核销员 PUT o2o/adm/v1/verifier
export function editVerifier(data) {
  return request({
    url: `/adm/v1/verifier`,
    method: 'put',
    data,
  })
}

// 删除活动核销员	DELETE /adm/v1/verifier/deleted/1
export function deleteVerifier(id) {
  return request({
    url: `/adm/v1/verifier/${id}`,
    method: 'delete',
  })
}
// 删除核销员活动	DELETE /adm/v1/verifier/deleted/1
export function deleteVerifierEvent(id) {
  return request({
    url: `/adm/v1/eventsVerifyPersonAuth/${id}`,
    method: 'delete',
  })
}

// 核销员活动列表	GET o2o/adm/v1/getVerifierList
export function getVerifierTableList(params) {
  return request({
    url: `/adm/v1/verifier/events/page/list`,
    method: 'get',
    params,
  })
}


// 添加核销员活动关联关系 POST o2o/adm/v1/verifier/events/auth
export function addEventsVerifierAuth(data) {
  return request({
    url: `/adm/v1/eventsVerifyPersonAuth`,
    method: 'post',
    data,
  })
}

// 添加营销活动
export function addMarketEvents(data, method) {
  return request({
    url: `/adm/v1/activityInfo`,
    method,
    data,
  })
}
// 营销活动列表
export function getMarketEventsList(params) {
  return request({
    url: `/adm/v1/activityInfo/page/list`,
    method: 'get',
    params
  })
}
// 营销活动详情
export function getMarketEventsDetail(id) {
  return request({
    url: `/adm/v1/activityInfo/` + id,
    method: 'get'
  })
}
// 删除活动	DELETE
export function deleteEventsMarket(id) {
  return request({
    url: `/adm/v1/activityInfo/${id}`,
    method: 'delete'
  })
}
// 助力活动排行
export function getEventsMarketRankList(params) {
  return request({
    url: '/adm/v1/activityInfo/rank/list',
    method: 'get',
    params
  })
}
// 获取分类
export function getBasicDataByCode(params) {
  return request({
    url: '/adm/v1/basicData/getBasicDataByCode',
    method: 'get',
    params
  })
}
// 活动排序接口
export function changeEventsInfoSort(data, type = 'eventsInfo') {
  const url = `/adm/v1/${type}/sort`
  return request({
    url,
    method: 'put',
    data
  })
}